
<template tag="以下文档内容为hycli自动生成">
  <div>
    <el-dialog
      v-model="conf.aaaqg_visible"
      title="完结任务"  width="30%"  draggable
      :close-on-click-modal="false"  :before-close="hide_aaaqg">
      <span>确认完结任务吗?</span>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aaaqg" icon="close">取消</el-button>
          <el-button type="primary" @click="save_aaaqg" icon="select">确定</el-button>
        </span>
      </template>
    </el-dialog>
    <el-dialog
      v-model="conf.aaaqd_visible"
      title="删除"  width="30%"  draggable
      :close-on-click-modal="false"  :before-close="hide_aaaqd">
      <span>确认删除吗?</span>
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="hide_aaaqd" icon="close">取消</el-button>
          <el-button type="primary" @click="save_aaaqd" icon="select">确定</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data(){
    return{
      conf:{
          aaaqg_visible:false, //完结任务
          aaaqd_visible:false, //删除
      },
      //完结任务
      form_aaaqg:{ 
        name:"",
      },
      //删除
      form_aaaqd:{ 
        daily_id:"",
      },
    }
  },
  methods:{
     //--------------------完结任务---------------------------------
      //显示 完结任务 弹出框
      show_aaaqg(fm){
         Object.assign(this.form_aaaqg,fm)
         this.conf.aaaqg_visible = true;
      },
      //隐藏 完结任务 弹出框
      hide_aaaqg(){
        this.conf.aaaqg_visible = false;
      },
      //保存 完结任务 弹出框数据
      save_aaaqg(){
        let that = this
        this.$theia.http.post("/ws/daily/task/finish",this.form_aaaqg).then(res=>{
          that.conf.confirmVisible = false 
          that.$notify.success({title: '成功',message: '完结任务成功',duration:5000})
          that.$emit("onsaved")
          that.hide_aaaqg()
       }).catch(err=>{
          that.conf.confirmVisible = false
          let code = err.response.status
          let msg= `完结任务失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
       })
    },
    //-----------------------------------------------------------
     //--------------------删除---------------------------------
      //显示 删除 弹出框
      show_aaaqd(fm){
         Object.assign(this.form_aaaqd,fm)
         this.conf.aaaqd_visible = true;
      },
      //隐藏 删除 弹出框
      hide_aaaqd(){
        this.conf.aaaqd_visible = false;
      },
      //保存 删除 弹出框数据
      save_aaaqd(){
        let that = this
        this.$theia.http.post("/ws/daily/task/del",this.form_aaaqd).then(res=>{
          that.conf.confirmVisible = false 
          that.$notify.success({title: '成功',message: '删除成功',duration:5000})
          that.$emit("onsaved")
          that.hide_aaaqd()
       }).catch(err=>{
          that.conf.confirmVisible = false
          let code = err.response.status
          let msg= `删除失败(${code})`
          that.$notify.error({title: '失败',message:msg,duration:5000})
       })
    },
    //-----------------------------------------------------------
  },
}
</script>